<template>
  <div>
    <van-search
      v-model="value"
      show-action
      :background="bgc"
      placeholder="请输入搜索关键词"
    >
    <template #left>
      <slot name="left"></slot>
    </template>
    <template #label>
      <div id="city" @click="choiceCity">{{city}}
        <van-icon name="arrow-down" /> <!--<span>|</span> -->
      </div>
    </template>
    <template #action>
      <van-icon name="location-o" @click="$router.push('/maphouse')"/>
    </template>
  </van-search>
  </div>
</template>

<script>
export default {
  data () {
    return {
      value: '',
      value2: 123,
      city: localStorage.getItem('cityName') || '城市'
    }
  },
  props: ['bgc'],
  methods: {
    choiceCity () {
      this.$router.push({
        name: 'city',
        query: this.city
      })
    }
  }

}
</script>

<style lang="less" scoped>
  #city{
    text-align: center;
    line-height: 34px;
  }
</style>
